<template>
  <div class="loading"><van-loading color="#1989fa" vertical>跳转登录中……</van-loading></div>
</template>

<script>
import { mapActions } from 'vuex'
export default {
  computed: {
    code () {
      return this.$route.query.code
    },

    returnUrl () {
      return this.$route.query.returnUrl
    }
  },

  methods: {
    ...mapActions('wx', ['getUserInfo']),
    /* async getAccessToken () {
      GET_USER_INFO({code: this.code}).then(res => {
        console.log(res)
        if (!res.errcode) {
          this.$router.replace(this.returnUrl)
        }
      })
    } */
  },

  created () {
    this.getUserInfo({ code: this.code }).then(() => {
      this.$router.replace(this.returnUrl)
      
    })
  }
} 
</script>

<style>
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}
</style>